<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>网站信息</title>
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <link rel="stylesheet" href="__STATIC__/css/layui.css">
    <script src="__STATIC__/layui.js"></script>
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>
<style>
    .bodys {
        font-size: large;
        color: #666;
    }

    .div {
        text-align: center;
        width: 1080px;
        margin: auto;
        padding-bottom: 30px;
    }

    table {
        border-collapse: collapse;
        width: 1080px
    }

    .spans {
        color: #000000;
        font-family: 黑体
    }

    .test_a {
        border: 1px solid black;
        width: 20%;
        vertical-align: middle;
        align: center;
        padding: 1px;
    }

    .test_b {
        border: 1px solid black;
        width: 70%;
        vertical-align: middle;
        text-align: left;
        padding: 20px
    }
</style>
<body class="bodys panel admin-panel">
<div style="font-size: 14px;color: black" class="panel-head"><strong><span class="icon-pencil-square-o"></span>角色信息&emsp;<a
        style="color: #1918fb;" href="javascript:history.go(-1)">返回上一步</a></strong></div>
<form action="{:url('Role/roleadd_sub')}" method="post" enctype="multipart/form-data">
    <div class="div">
        <div style="margin-top: 10px">
            角色：<input type="text" name="role">
        </div>
        <div style="margin-top: 30px;margin-bottom: 30px">
            <span style="text-align: center; vertical-align: middle">描述 ：</span>
            <textarea style="overflow: scroll; width: 320px; height: 120px" name="descript"></textarea>
        </div>
        <table id="table" lay-filter="">
            {volist name="jurisdiction" id="vo"}
            <tr>
                <td class="test_a">
                    <input onclick='selectAlls("{$vo.id}")' name="{$vo.id}" id="{$vo.id}" type="checkbox"
                           value="{$vo.id}"/>&nbsp;{$vo.jurisdiction}
                </td>
                <td class="test_b">
                    {volist name="vo.url" id="vv"}
                    <input onclick='cws("{$vo.id}")' type="checkbox" class="{$vo.id}" name="{$vv.id}" value="{$vv.id}"/>&nbsp;{$vv.jurisdiction}&emsp;
                    {/volist}
                </td>
            </tr>
            {/volist}
        </table>
        <div style="margin-top: 2%">
            <input onclick='selecta()' type="checkbox" id="qx" value="全选"/>全选 &emsp;
            <input class="layui-btn" type="submit" name="submit" value="添加">
        </div>

    </div>
</form>



</body>
<script>
    /*function cw() {
     var checklists = document.getElementsByName("selected");
     for (var m = 0; m < checklists.length; m++) {
     if (checklists[m].checked) {
     document.getElementById("controlAll1").checked = 1
     }
     }
     }
     function selectAll() {
     var checklist = document.getElementsByName("selected");
     if (document.getElementById("controlAll1").checked) {
     for (var i = 0; i < checklist.length; i++) {
     checklist[i].checked = 1;
     }
     } else {
     for (var j = 0; j < checklist.length; j++) {
     checklist[j].checked = 0;
     }
     }
     }*/
    function cws(id) {
        //自己选择父级默认被选
        var checklists = document.getElementsByClassName(id);
        for (var m = 0; m < checklists.length; m++) {
            if (checklists[m].checked) {
                document.getElementById(id).checked = 1
            }
        }
    }
    function selectAlls(ids) {
        //选择父级自己全选
        var checklist = document.getElementsByClassName(ids);
        if (document.getElementById(ids).checked) {
            for (var i = 0; i < checklist.length; i++) {
                checklist[i].checked = 1;
            }
        } else {
            for (var j = 0; j < checklist.length; j++) {
                checklist[j].checked = 0;
            }
        }
    }
    function selecta() {
        var inp = $('#table').find('input');
        if (document.getElementById('qx').checked) {
            //全选
            for (var n = 0; n < inp.length; n++) {
                inp[n].checked = 1;
            }
        } else {
            //全不选
            for (var num = 0; num < inp.length; num++) {
                inp[num].checked = 0;
            }
        }
    }
</script>
</html>